﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeTop.复习九月份
{
    public class Solution83
    {
        public ListNode DeleteDuplicates(ListNode head)
        {
            ListNode cur = head;
            ListNode next = null;

            while (cur.next != null)
            {
                next = cur.next;

                if (next.val == cur.val)
                {
                    //删除next
                    cur.next = next.next;
                }
                else
                {
                    cur = next;
                }
            }
            return head;
        }
    }
}